//pages/designer/detail.js

var api=require("../../utils/api.js");
var diyparams=require("../../utils/data.js");
Page({
    data:{}

    onload: function(options){
        this.loaddetail(options.id);
        this.setData({
            paramsname: diyparams.params
        });
    },
    loaddetail(id){
        api.get({
            url: "/portal/articles/"+id,
            success: data=>{
                if(data.code=='1'){
                    this.setData({
                        detail: data.data
                    })
                }
            }
        })
    },

    yuyuefunc(e){
        this.dialog.showModal();
    },
    _hideModal(){
        this.dialog.hideModal();
    },

    formSubmit(e){
        api.post({
            url: "/portal/diyform/insert",
            data: e.detail.value,
            success: data=>{
                if(data.code=='1'){
                    wx.showToast({title: "报名成功", icon: "success"})
                }
                if(data.code=='0'){
                    wx.showToast({title: data.msg, icon: 'none'})
                }
            }
        })
    },

    onReady: function(){},
    onShow: function(){},

    onHide: function(){},
    onUnload: function(){},
    onPullDownRefresh: function(){},
    onReachBottom: function(){},
    onShareAppMessage: function(){}


})